package com.atzly.community.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**  讨论帖对象
 * es搜索: 配置es映射
 * @author zlysimida
 * @date 2021/8/25 - 11:16
 */
@Data
@Document(indexName = "discusspost",shards = 6,replicas =3)  //添加es配置
public class DiscussPost {
    @Id
    private int id;

    @Field(type = FieldType.Integer)
    private int userId;     //外键关联User表

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String title;

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String content;

    // '0-普通; 1-置顶;'
    @Field(type = FieldType.Integer)
    private Integer type = 0;

    // '0-正常; 1-精华; 2-拉黑;',
    @Field(type = FieldType.Integer)
    private Integer status = 0;

    @Field(type = FieldType.Date)
    private Date createTime;

    @Field(type = FieldType.Integer)
    private Integer commentCount = 0;

    @Field(type = FieldType.Double)
    private double score;
}
